<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Projects.ProjectVolunteerViewModel>" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Stimulus360.Services" %>
<%@ Import Namespace="Stimulus360.Controllers"%>
<%@ Import Namespace="Stimulus360.Models.Data" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<%RatingViewModel ratingViewModel = new RatingViewModel
  {
      Id = Model.ProjectSummary.ProjectId,
      AverageRating = Model.ProjectSummary.AverageRating,
      IsDisabled = true
  };
  Volunteer volunteer = Model.Volunteer;
  bool userAlreadyVolunteer = false;
  if (volunteer != null)
      userAlreadyVolunteer = true;
%>
    <div class="centerContainer">
        <!-- Left Col Start -->
        <%Html.RenderPartial("ProjectDetailLeftNavigation", Model.ProjectSummary ); %>
        <!-- Left Col Ends -->
        <!-- Main Area Start -->
        <div class="mainInner colViewHdr">
            
            <div class="projListItem p10">
            <h1><%=Html.Encode(Model.ProjectSummary.ProjectTitle) %></h1>
            <div class="projStatusBar mt10">
                <div class="floatLeft pt02"><%=Model.ProjectSummary.SubmittedDate.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))%> | PM: <%=Model.ProjectSummary.Submitter %></div>
                
                <div class="projStatus floatLeft pl10">
                  <div><%Html.RenderPartial("Rating", ratingViewModel); %></div>
                  <div class="separatorR">(<%=Model.ProjectSummary.UserRatingsCount %>)</div>
                  <div class="separatorR pt02">Favorites <%=Model.ProjectSummary.FavoritesCount%></div>
                  <div class="projStatusRpt">
                    <h4>Status: </h4>
                    <div> &nbsp;<%= Html.Image(Model.ProjectSummary.StatusString.ToLower() + ".png", "") %> </div>
                    <div class="statusWdth"><%=Model.ProjectSummary.StatusString %></div>
                  </div>
                    <br clear="all" />
                </div>
            </div>
      </div>
            <br clear="all" />
            <h3>Join as a Volunteer</h3>
            
            <div class="projListVolnItem projListItemBg">
                <br />
                <h4><strong><%=Model.DisplayText %></strong></h4>
                <div class="buttons bgComn pt10">
                    <% using (Html.BeginForm())
                       {
                    %>
                        <%=Html.AntiForgeryToken() %>
                        <%=Html.Hidden("projectId", Model.ProjectSummary.ProjectId) %>
                        <%=Html.Hidden("userName", User.Identity.Name)%>
                        <%if (!userAlreadyVolunteer)
                          {%>
                            <input name="Yes" type="submit" value="Yes" class="pr10" />
                            &nbsp;<input name="no" type="button" value="No" class="cancel" />
                        <%}
                          else
                          {%>
                            <input name="no" type="button" value="OK" class="cancel" />
                        <%} %>
                    <%} %> <!-- End of form -->
                </div>
            </div>
            <br clear="all" />
            <!-- Main Area End -->
        </div>
    </div>
<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        $("#volunteers").click();
        $(".cancel").click(function() {
            var projectId = "<%=Model.ProjectSummary.ProjectId %>";
            window.location.href = "/Projects/" + projectId + "/Volunteers";
        });
    });
        
</script>        
</asp:Content>
